#ifndef VM_SWAP_H
#define VM_SWAP_H

#include <devices/disk.h>
#include "vm/frame.h"

struct swap_info
{
    struct page_id id;
    int status; /* -1 : NONE, 0 : ALLOCATED, 1 : RELEASED */
};

struct disk* swap_disk;
uint32_t swap_max_page_num;
struct swap_info* swap_list;
uint32_t swap_info_next_idx;

void swap_init (void);
void swap_load (struct page_id*, void*);
bool swap_allocate (struct page_id*, struct page_id*, uint32_t*);
void swap_out (uint32_t, void*);
void swap_release (struct thread*);
uint32_t get_swapped_page (struct page_id*);

#endif /* VM_SWAP_H */
